{extend name="index_layout"/}
{block name="main"}
<div class="layui-card layer-popup">
    <div class="layui-card-body">
        <div class="admin-main layui-anim layui-anim-upbit">
            <form class="layui-form layui-form-pane" lay-filter="form">
                <div class="layui-form-item">
                    <label class="layui-form-label">所属角色</label>
                    <div class="layui-input-inline">
                        <select name="group_id" lay-verify="required" {if !empty($info) && $info.group_id !=1 }disabled{/if}>
                            <option value="">请选择角色</option>
                            {volist name="authGroup" id="vo"}
                            <option value="{$vo.id}" {if !empty($info) && $info.group_id==$vo.id} selected {/if} >{$vo.title}</option>
                            {/volist}
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">所属部门</label>
                    <div class="layui-input-inline">
                        <select name="dept_id" lay-verify="required" {if !empty($info) && $info.group_id !=1 }disabled{/if}>
                        <option value="">请选择部门</option>
                        {volist name="authDept" id="vo"}
                        <option value="{$vo.id}" {if !empty($info) && $info.dept_id==$vo.id} selected {/if} >{$vo.title}</option>
                        {/volist}
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">{:lang('username')}</label>
                    <div class="layui-input-inline">
                        <input type="text" name="username" lay-verify="required" placeholder="{:lang('pleaseEnter')}登录用户名" class="layui-input {if $info && $info.id!==1}layui-disabled{/if}"  {if  $info && $info.id!==1}readonly="readonly"{/if}>
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        用户名在4到25个字符之间。
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">{:lang('password')}</label>
                    <div class="layui-input-inline">
                        <input type="password" name="password" placeholder="{:lang('pleaseEnter')}登录密码" autocomplete="true" {if !empty($info)} lay-verify="required"{/if} class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        密码必须大于6位，小于15位。
                    </div>
                </div>
                <div class="layui-form-item item-flex">
                    <label class="layui-form-label">头像</label>
                    <div class="layui-input-inline item-wide border-none">
                        <div class="js-upload-image">
                            {if $info}
                            {php}echo \util\Form::images('avatar','',$info['avatar']);{/php}
                            {else}
                            {php}echo \util\Form::images('avatar');{/php}
                            {/if}
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">{:lang('email')}</label>
                    <div class="layui-input-inline">
                        <input type="text" name="email" lay-verify="email" placeholder="{:lang('pleaseEnter')}用户邮箱" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        用于密码找回，请认真填写。
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">{:lang('mobile')}</label>
                    <div class="layui-input-inline">
                        <input type="text" name="mobile" lay-verify="phone" value="" placeholder="{:lang('pleaseEnter')}手机号" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layer-footer">
                    <div>
                        <input type="hidden" name="id"  >
                        <button type="button" class="layui-btn" lay-submit="" lay-filter="submit"><i class="layui-icon layui-icon-form"></i> {:lang('submit')}</button>
                        <button type="reset" class="layui-btn layui-btn-primary"> <i class="layui-icon layui-icon-delete"></i>{:lang('reset')}</button>
                    </div>
                </div>
            </form>
        </div>

    </div>
</div>
{/block}
{block name="script"}
<script>
    layui.use(['Admin','laydate','form'], function() {
        var form = layui.form,
            layer = layui.layer,
            $= layui.jquery;
        var info = '';
        info = {:json_encode($info)};
        form.val("form", info);
        if(info){
            $('#addPic').attr('src',info.avatar);
        }
        form.render();

    });
</script>
{/block}